import 'package:flutter_ohos/generated/json/base/json_convert_content.dart';
import 'package:flutter_ohos/app/modules/mine/model/login_user_data_entity.dart';

LoginUserDataEntity $LoginUserDataEntityFromJson(Map<String, dynamic> json) {
  final LoginUserDataEntity loginUserDataEntity = LoginUserDataEntity();
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    loginUserDataEntity.name = name;
  }
  final String? phone = jsonConvert.convert<String>(json['phone']);
  if (phone != null) {
    loginUserDataEntity.phone = phone;
  }
  final String? account = jsonConvert.convert<String>(json['account']);
  if (account != null) {
    loginUserDataEntity.account = account;
  }
  final int? isVip = jsonConvert.convert<int>(json['isVip']);
  if (isVip != null) {
    loginUserDataEntity.isVip = isVip;
  }
  final String? headImg = jsonConvert.convert<String>(json['headImg']);
  if (headImg != null) {
    loginUserDataEntity.headImg = headImg;
  }
  return loginUserDataEntity;
}

Map<String, dynamic> $LoginUserDataEntityToJson(LoginUserDataEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['name'] = entity.name;
  data['phone'] = entity.phone;
  data['account'] = entity.account;
  data['isVip'] = entity.isVip;
  data['headImg'] = entity.headImg;
  return data;
}

extension LoginUserDataEntityExtension on LoginUserDataEntity {
  LoginUserDataEntity copyWith({
    String? name,
    String? phone,
    String? account,
    int? isVip,
    String? headImg,
  }) {
    return LoginUserDataEntity()
      ..name = name ?? this.name
      ..phone = phone ?? this.phone
      ..account = account ?? this.account
      ..isVip = isVip ?? this.isVip
      ..headImg = headImg ?? this.headImg;
  }
}